package com.ss.android.article.base.ui;

import android.content.Context;
import android.graphics.Canvas;
import android.text.Layout;
import android.text.StaticLayout;
import android.util.AttributeSet;
import android.widget.TextView;

public class EllipsisTextView extends TextView {
    public interface a {
        void a(boolean arg1);
    }

    private a a;
    private int b;
    private boolean c;

    public EllipsisTextView(Context arg1) {
        super(arg1);
    }

    public EllipsisTextView(Context arg1, AttributeSet arg2) {
        super(arg1, arg2);
    }

    public EllipsisTextView(Context arg1, AttributeSet arg2, int arg3) {
        super(arg1, arg2, arg3);
    }

    protected void dispatchDraw(Canvas arg6) {
        boolean v0 = true;
        super.dispatchDraw(arg6);
        Layout v2 = this.getLayout();
        if(v2 != null) {
            int v3 = v2.getLineCount();
            if(v3 > 0) {
                if((v2 instanceof StaticLayout)) {
                    if(v2.getEllipsisCount(v3 - 1) <= 0) {
                        v0 = false;
                    }
                }
                else if(v3 <= this.b) {
                    v0 = false;
                }

                this.c = v0;
            }
        }
    }

    public void draw(Canvas arg3) {
        super.draw(arg3);
        if(this.getLayout() != null && (this.c) && this.a != null) {
            this.a.a(this.c);
        }
    }

    public void setMaxLines(int arg2) {
        super.setMaxLines(arg2);
        this.b = arg2;
        this.c = false;
    }

    public void setOnEllipsisStatusChangeListener(a arg1) {
        this.a = arg1;
    }
}

